# -*- coding: utf-8 -*-
"""
@author: dengpanxiao(@126.com)

@file: orm.py

@time: 17/12/3 下午4:16

@desc: ORM映射模块

"""


class ModelMetaclass(type):
    def __new__(cls, new, bases, attrs):
        mapping = ... #读取cls的Field字段
        __table__ = cls.__table__
        



# ORM映射基类
class Model(dict):
    __metaclass__ = ModelMetaclass

    def __init__(self, **kw):
        super(Model, self).__init__(**kw)

    def __getattr__(self, key):
        try:
            return self[key]
        except KeyError:
            raise AttributeError("'Dict' object has no attribute '%s'" % key)

    def __setattr__(self, key, value):
        self[key] = value

